<template>
<div>
  <el-tree :data="dataTree" :props="defaultProps" :default-expand-all="true"></el-tree>
</div>
</template>

<script>
import {getSubjectList} from "@/api/subject";

export default {
  data() {
    return {
      dataTree:[],
      defaultProps:{
        label:'title',
        children:'children',
      }
    };
  },
  methods: {
   SubjectList(){
     let that = this
     getSubjectList().then(function (res){
       if (res.code == 20000){
         that.dataTree = res.data
       }
     })
   }
  },

  created() {
    this.SubjectList()
  }
}
</script>

<style scoped lang="scss">

</style>
